package com.example.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.warehouse;
import com.example.demo.mapper.warehouseMapper;
import com.example.demo.service.WarehouseService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;
@Service
public class WarehouseServiceImpl extends ServiceImpl<warehouseMapper, warehouse> implements WarehouseService{
    @Resource
    private warehouseMapper warehouseMapper;
    @Override//重写service方法
    public List warehouse(@RequestBody warehouse warehouse)//根据标识和名称查询仓库零件信息
    {
        return warehouseMapper.selectComsign(warehouse);
    }
    @Override
    public String update(@RequestBody warehouse warehouse){//修改内容修改成功返回1修改失败返回0
        if(warehouseMapper.updatewarehouse(warehouse)==1){//判断是否完成修改
            return "修改成功";
        }
        else {return "修改失败";}

    }
    @Override
    public String delete(@RequestBody warehouse warehouse){//输入主键删除
        if(warehouseMapper.deletewarehouse(warehouse.getComname(),warehouse.getComsign())==1){//判断是否删除成功
            return "删除成功";
        }
        else {
            return "删除失败";
        }
    }
}
